fil = open('1.txt')
result = []
for line in fil:
    if line in result:
        line = "***" + line
    result.append(line)

result_file = open('result_file.txt', 'w')
for line in result:
    result_file.writelines(line)
